//
//  NeedCenterTableViewCell.m
//  ForestPack
//
//  Created by 郑洲 on 2018/7/5.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "NeedCenterTableViewCell.h"

@interface NeedCenterTableViewCell ()

@property (nonatomic, strong) UILabel *eventLabel;
@property (nonatomic, strong) UILabel *detaiLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *numLabel;

@end

@implementation NeedCenterTableViewCell

+ (NeedCenterTableViewCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"NeedCenterTableViewCell";
    NeedCenterTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[NeedCenterTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    
    return cell;
}

-(void)setCustomDemandHallDataModel:(CustomDemandHallDataModel *)customDemandHallDataModel
{
    _customDemandHallDataModel = customDemandHallDataModel;
    
    self.eventLabel.text = customDemandHallDataModel.category;
    self.detaiLabel.text = customDemandHallDataModel.demand;
    self.timeLabel.text = [[[NSString stringWithFormat:@"倒计时：%@天",customDemandHallDataModel.days] stringByAppendingString:[NSString stringWithFormat:@"%@小时",customDemandHallDataModel.hours]] stringByAppendingString:[NSString stringWithFormat:@"%@分",customDemandHallDataModel.mins]];
    self.numLabel.text = [NSString stringWithFormat:@"竞标：%@",customDemandHallDataModel.total];
}

- (void)createSubView {
    self.eventLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(13), ScreenX375(13), ScreenX375(220), ScreenX375(18))];
    self.eventLabel.textColor = REXADECIMALCOLOR(@"#333333");
    self.eventLabel.font = Kfont(14);
    self.eventLabel.text = @"海报设计";
    [self addSubview:self.eventLabel];
    
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - ScreenX375(173), ScreenX375(16), ScreenX375(160), ScreenX375(14))];
    self.timeLabel.textColor = ThemeColor;
    self.timeLabel.font = Kfont(12);
    self.timeLabel.textAlignment = NSTextAlignmentRight;
    self.timeLabel.text = @"倒计时：30天22小时15分";
    [self addSubview:self.timeLabel];
    
    UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(13), ScreenX375(40) - 0.5, SCREEN_WIDTH - ScreenX375(26), 0.5)];
    line.image = [UIImage imageNamed:@"虚线"];
    [self addSubview:line];
    
    self.detaiLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(13), ScreenX375(49), ScreenX375(250), ScreenX375(14))];
    self.detaiLabel.textColor = REXADECIMALCOLOR(@"#999999");
    self.detaiLabel.font = Kfont(12);
    self.detaiLabel.text = @"我需要包装设计  要求：根据包装出一份设计";
    [self addSubview:self.detaiLabel];
    
    self.numLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - ScreenX375(73), ScreenX375(49), ScreenX375(60), ScreenX375(14))];
    self.numLabel.textColor = REXADECIMALCOLOR(@"#999999");
    self.numLabel.font = Kfont(12);
    self.numLabel.textAlignment = NSTextAlignmentRight;
    self.numLabel.text = @"竞标：8";
    [self addSubview:self.numLabel];
}


@end
